package com.tinker.app;

import android.content.Context;

import com.tencent.tinker.loader.app.TinkerApplication;
import com.tencent.tinker.loader.shareutil.ShareConstants;

import androidx.multidex.MultiDex;

/**
 * Created by amazingZZ on 2020-03-16
 */
public class SampleApplication extends TinkerApplication {
    public SampleApplication() {
        super(
                //tinkerFlags, which types is supported
                //dex only, library only, all support
                ShareConstants.TINKER_ENABLE_ALL,
                // This is passed as a string so the shell application does not
                // have a binary dependency on your ApplicationLifeCycle class.
                "com.tinker.app.SampleApplicationLike");
    }

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(base);

//        SampleApplicationContext.application = this;
//        SampleApplicationContext.context = this;
//
//        com.tinker.app.tinker.tinker.util.TinkerManager.initFastCrashProtect();
//        //should set before tinker is installed
//        com.tinker.app.tinker.tinker.util.TinkerManager.setUpgradeRetryEnable(true);
//
//        //optional set logIml, or you can use default debug log
//        TinkerInstaller.setLogIml(new MyLogImp());
//
//        //installTinker after load multiDex
//        //or you can put com.tencent.tinker.** to main dex
//        TinkerPatchApplicationLike tinkerPatchApplicationLike
//        LoadReporter loadReporter = new SampleLoadReporter(this);
//        //or you can just use DefaultPatchReporter
//        PatchReporter patchReporter = new SamplePatchReporter(this);
//        //or you can just use DefaultPatchListener
//        PatchListener patchListener = new SamplePatchListener(this);
//        //you can set your own upgrade patch if you need
//        AbstractPatch upgradePatchProcessor = new UpgradePatch();

//        Tinker tinker = new Tinker.Builder(applicationLike.getApplication())
//                .tinkerFlags(applicationLike.getTinkerFlags())
//                .loadReport(loadReporter)
//                .listener(listener)
//                .patchReporter(patchReporter)
//                .tinkerLoadVerifyFlag(applicationLike.getTinkerLoadVerifyFlag()).build();
//
//        Tinker.create(tinker);
//        tinker.install(applicationLike.getTinkerResultIntent(), resultServiceClass, upgradePatchProcessor);
//        Tinker tinker = Tinker.with(this);

    }
}

